// 用户接口
export interface User {
  id: string;
  username: string;
  email: string;
  password?: string; // 加密存储，通常不返回给前端
  avatar: string; // 头像URL
  nickname: string;
  gender: 'male' | 'female' | 'other';
  bio: string; // 个人简介
  preferences: object; // 偏好设置
  createdAt: Date;
  updatedAt: Date;
  lastLogin: Date;
  totalGames: number; // 总游戏次数
  wins: number; // 胜利次数
  points: number; // 积分
}

// 用户注册请求接口
export interface RegisterRequest {
  username: string;
  email: string;
  password: string;
  confirmPassword: string;
}

// 用户登录请求接口
export interface LoginRequest {
  identifier: string; // 用户名或邮箱
  password: string;
  rememberMe?: boolean;
}

// 海龟汤接口
export interface Soup {
  id: string;
  title: string;
  surface: string; // 汤面
 汤底: string; // 汤底
  difficulty: 'easy' | 'medium' | 'hard';
  theme: string[];
  creatorId: string | null; // 创建者ID，系统题目为null
  isOfficial: boolean; // 是否官方题目
  status: 'draft' | 'pending' | 'published' | 'rejected';
  playCount: number; // 游玩次数
  rating: number; // 评分
  createdAt: Date;
  updatedAt: Date;
  publishedAt: Date;
}

// 创建海龟汤请求接口
export interface CreateSoupRequest {
  title: string;
  surface: string;
 汤底: string;
  difficulty: 'easy' | 'medium' | 'hard';
  theme: string[];
  isDraft?: boolean;
}

// 游戏记录接口
export interface GameRecord {
  id: string;
  userId: string;
  soupId: string;
  status: 'ongoing' | 'completed' | 'abandoned';
  startTime: Date;
  endTime: Date | null;
  questions: string[]; // 用户提问历史
  answers: string[]; // AI回答历史
  score: number | null; // 得分
  hintsUsed: number; // 使用提示次数
}

// 游戏信息接口
export interface GameInfo {
  id: string;
  userId: string;
  soupId: string;
  soup: Soup;
  status: 'ongoing' | 'completed' | 'abandoned';
  startTime: Date;
  difficulty: 'easy' | 'medium' | 'hard';
  themes: string[];
  hintsUsed: number;
  questionsAsked: number;
  maxQuestions: number;
}

// 提问请求接口
export interface AskQuestionRequest {
  question: string;
}

// 回答响应接口
export interface AnswerResponse {
  id: string;
  content: string;
  type: 'yes' | 'no' | 'irrelevant' | 'partially_correct' | 'need_more_info';
  gameId: string;
  createdAt: Date;
}

// 聊天消息接口
export interface ChatMessage {
  id: string;
  roomId: string | null; // 聊天室ID，私聊为null
  senderId: string;
  receiverId: string | null; // 私聊接收者ID
  content: string;
  type: 'text' | 'image' | 'system';
  isRead: boolean;
  createdAt: Date;
}

// 聊天室接口
export interface ChatRoom {
  id: string;
  name: string;
  description: string;
  isPublic: boolean;
  password: string | null;
  maxUsers: number;
  ownerId: string;
  createdAt: Date;
  updatedAt: Date;
}

// 房间信息接口
export interface RoomInfo {
  id: string;
  name: string;
  hostId: string;
  status: 'waiting' | 'playing' | 'completed';
  playerCount: number;
  maxPlayers: number;
  hasPassword: boolean;
  gameConfig: {
    difficulty: 'easy' | 'medium' | 'hard';
    themes: string[];
  };
  createdAt: Date;
}

// 创建房间请求接口
export interface CreateRoomRequest {
  name: string;
  password?: string;
  maxPlayers: number;
  gameConfig: {
    difficulty: 'easy' | 'medium' | 'hard';
    themes: string[];
  };
}

// WebSocket消息接口
export interface WebSocketMessage {
  type: string; // 消息类型（player_joined, player_left, chat_message, game_state等）
  data: any;
  timestamp: number;
  senderId?: string;
}

// 排行榜条目接口
export interface LeaderboardEntry {
  rank: number;
  userId: string;
  nickname: string;
  avatar: string;
  score: number;
  winRate?: number;
  totalGames?: number;
  fastestTime?: number;
}

// 成就接口
export interface Achievement {
  id: string;
  name: string;
  description: string;
  icon: string;
  category: string;
  rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary';
  condition: string;
}

// 用户成就接口
export interface UserAchievement {
  achievementId: string;
  unlocked: boolean;
  unlockedAt?: Date;
  progress?: number;
  currentValue?: number;
  targetValue?: number;
}